package com.eos.control.action.activity;

import com.eos.business.service.SysActivityBusinessService;
import com.eos.common.tool.ObjectUtils;
import com.eos.control.action.base.AbstractBaseAction;
import com.eos.orm.mybatis.model.SysCombo;
import com.eos.orm.mybatis.model.SysUser;

public class UpdateSetMealAction extends AbstractBaseAction {
	private static final long serialVersionUID = -3031532900527763592L;
	private Integer setMealId;
	private String comboName;
	private String comboPrice;
	private String comboDesc;

	public void setSetMealId(Integer setMealId) {
		this.setMealId = setMealId;
	}

	public void setComboName(String comboName) {
		this.comboName = comboName;
	}

	public void setComboPrice(String comboPrice) {
		this.comboPrice = comboPrice;
	}

	public void setComboDesc(String comboDesc) {
		this.comboDesc = comboDesc;
	}

	@Override
	public String execute() {
		try {
			if (setMealId == null || setMealId.intValue() <= 0) {
				statusCode = "300";
				message = "参数错误,保存信息失败!";
			} else {
				SysUser user = (SysUser) getSession().getAttribute("SysUser");
				SysCombo combo = new SysCombo();
				combo.setId(setMealId);
				combo.setComboName(comboName);
				combo.setComboDesc(comboDesc);
				combo.setComboPrice(comboPrice);
				combo.setUpdateUserId(user.getUserId().toString());
				combo.setModifyTime(ObjectUtils.formatDate(null, "yyyy-MM-dd HH:mm:ss"));
				SysActivityBusinessService sabs = new SysActivityBusinessService();
				String exeStatus = sabs.updateSysComboPKSelective(combo);
				if("SUCCESS".equals(exeStatus)){
					statusCode = "200";
					message = "修改套餐信息成功!";
				}else{
					statusCode = "300";
					message = "系统繁忙, 修改套餐信息失败!";
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
			statusCode = "300";
			message = "系统异常, 保存套餐信息失败!";
		}
		return SUCCESS;
	}
}
